#include "change_password.h"
#include "ui_change_password.h"

forget_password::forget_password(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::forget_password)
{
    ui->setupUi(this);

    QFile file(":/change.qss"); // 假设style.qss位于资源文件中
    if (file.open(QFile::ReadOnly))
    {
        setStyleSheet(QString(file.readAll())); // 应用全局样式
        file.close();
    }

    setWindowFlag(Qt::FramelessWindowHint,true);//去掉主窗口的边框
    setAttribute(Qt::WA_TranslucentBackground,true);//把主窗口透明
}

forget_password::~forget_password()
{
    delete ui;
}

void forget_password::on_closeButton_clicked()
{
    MainWindow * mw = new MainWindow;
    mw->show();
    this->close();
}

void forget_password::mousePressEvent(QMouseEvent *event)
{
    if(false == ui->nextButton->underMouse() && false == ui->closeButton->underMouse())
        mouseOff = event->globalPos() - geometry().topLeft();
    ui->usernameLineEdit->clearFocus();
}

void forget_password::mouseMoveEvent(QMouseEvent *event)
{
    if(false == ui->nextButton->underMouse() && false == ui->closeButton->underMouse())
        this->move(event->globalPos() - mouseOff);
}

void forget_password::on_nextButton_clicked()
{

}

